<template>
    <div id="user-info">
      <a href="#" class="clear-fix">
        <slot name="user-icon">
          <svg class="privateImage-svg left">
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#avatar-default"></use>
          </svg>
        </slot>
        <div class="login-info left">
          <slot name="user-nickname">
            <div>登录/注册</div>
          </slot>
          <div class="phone">
            <span>
              <svg data-v-735ff1be="" fill="#fff" class="icon-mobile"><use data-v-735ff1be="" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#mobile"></use></svg>
            </span>
            <slot name="user-phone">暂无绑定手机号</slot>
          </div>
        </div>
        <svg data-v-735ff1be="" fill="#fff" class="arrow-svg right"><use data-v-735ff1be="" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use></svg>
      </a>
    </div>
  </template>

<script>
    import {mapState} from 'vuex'

    export default {
        name : 'userTop',
        data () {
            return {
                test:'测试'
           }
        },
        computed: {
            ...mapState({
                getName(state) {
                    return this.test + state.userInfo.name
                },
                userInfo: 'userInfo'
            }),
            isShow() {
                return Object.keys(this.userInfo).length <= 0  // 如果用户没有登录
            }
        }
    }
</script>

<style scoped>
 #user-info {
    background-color: var(--color-tint);
    padding: 15px;
    margin-top: -5px;
  }

  #user-info .privateImage-svg {
    width: 60px;
    height: 60px;
    background-color: #fff;
    border-radius: 30px;
  }

  .left {
    float: left;
  }

  #user-info .arrow-svg {
    width: 11px;
    height: 22px;
    margin-top: 18px;
  }

  #user-info .login-info {
    color: #fff;
    margin: 10px 0 0 10px;
  }

  #user-info .login-info .phone {
    position: relative;

    font-size: 13px;
    margin-top: 5px;
    margin-left: 15px;
    font-weight: 300;
  }

  #user-info .login-info .phone .icon-mobile {
    position: absolute;
    width: 12px;
    height: 18px;
    left: -15px;
    top: 0px;
  }
</style>